#ifndef __DBCOM_H__
#define __DBCOM_H__

#define CONNECT_QT	             	50
#define SQL_BUF_LEN	             	(1024*1024)

#define DEFAULT_DEFINITION 		unsigned int errcode

#define ThrdConn                	a_thrd_conn[thrd_index]

#define CheckErr \
checkerr(ThrdConn.sock, &errcode)

#define ReturnErr \
do \
{ \
    CheckErr; \
    return(errcode); \
} while(0)


typedef struct
{
    MYSQL mysql, *sock;
    MYSQL_RES *res;
    MYSQL_ROW row;
    char *sql;
} thrd_conn_t;
extern thrd_conn_t a_thrd_conn[CONNECT_QT];

extern void checkerr(MYSQL *sock, unsigned int *errcode);

#endif
